import requests
import time
import os

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
                  "Chrome/76.0.3809.132 Safari/537.36"}
time = int(time.time() * 1000)
url = 'http://192.168.1.125:5555/SW/GenImg?%s' % time
print(url)
res = requests.get(url, headers=headers)
fp = os.path.join(os.path.dirname(os.path.abspath('.')), 'picture\\authcode.jpg')
with open(fp, "wb") as f:
    f.write(res.content)
